package com.richrail.model;

import com.richrail.model.entities.Train;

public class TrainFactory
{
	private NameGenerator nameGen;
	
	public TrainFactory(NameGenerator nameGen)
	{
		this.nameGen = nameGen;
	}
	
	public Train create(String name)
	{
		if (name == null) name = nameGen.generateName();
		return new Train(name);
	}
}
